from aiogram_dialog import DialogManager

from poker_bot.database.services import ReviewService


async def reviews_getter(
    dialog_manager: DialogManager, review_service: ReviewService, **kwargs
):
    reviews = await review_service.get_reviews()

    return {"reviews": reviews}


async def review_info_getter(
    dialog_manager: DialogManager, review_service: ReviewService, **kwargs
):
    review_id: int = dialog_manager.dialog_data.get("review_id")
    review = await review_service.get_review_by_id(review_id)

    return {
        "review_text": review.review_text,
        "review_date": review.review_date,
    }
